home *** CD-ROM | disk | FTP | other *** search
- property pTrackmanager, pSN, pPosition, pAnimProgression, pDirection, pStartSize, pEndSize, pDuration, pRotationSpeed, pRotation, pStartBlending, pCallBacks, pWidth, pHeight
- global gEffects
-
- on new me, tTrackManager, tPosition, tInitData
- pTrackmanager = tTrackManager
- pSN = pTrackmanager.getSpriteManager().getSN(3, #smokepuff)
- pPosition = point(tPosition[1], tPosition[2])
- pStartSize = tInitData[#startsize]
- pEndSize = tInitData[#endsize]
- pDuration = tInitData[#duration]
- pDirection = tInitData[#direction]
- pRotationSpeed = tInitData[#rotationspeed]
- pAnimProgression = 0
- if tInitData[#startBlending] = VOID then
- pStartBlending = 0
- else
- pStartBlending = tInitData[#startBlending]
- end if
- pTrackmanager.INeedADisplayUpdateEachFrame(me)
- pTrackmanager.INeedAnUpdateEachFrame(me)
- pCallBacks = tInitData[#callbacks]
- if pCallBacks <> VOID then
- docallback(pCallBacks[#start], me)
- end if
- sprite(pSN).member = member("smokepuffimage")
- if tInitData[#backColor] <> VOID then
- sprite(pSN).backColor = tInitData[#backColor]
- end if
- if tInitData[#foreColor] <> VOID then
- sprite(pSN).foreColor = tInitData[#foreColor]
- else
- sprite(pSN).foreColor = 0
- end if
- pRotation = random(360)
- return me
- end
-
- on cleanUp me
- pTrackmanager.IDontNeedADisplayUpdateEachFrame(me)
- pTrackmanager.IDontNeedAnUpdateEachFrame(me)
- pTrackmanager.getSpriteManager().returnSN(pSN, #smokepuff)
- if pCallBacks <> VOID then
- docallback(pCallBacks[#end], me)
- end if
- pCallBacks = 0
- pTrackmanager = 0
- return 0
- end
-
- on Update me, tTimeMultiplier
- pAnimProgression = pAnimProgression + (tTimeMultiplier / pDuration)
- if pAnimProgression > 1 then
- me.cleanUp()
- end if
- pWidth = pStartSize + (pAnimProgression * (pEndSize - pStartSize))
- pHeight = pStartSize + (pAnimProgression * (pEndSize - pStartSize))
- pPosition = pPosition + (pDirection * tTimeMultiplier / 10)
- pRotation = pRotation + (tTimeMultiplier * pRotationSpeed)
- end
-
- on getRect me
- return rect(pPosition[1] - (pWidth / 2), pPosition[2] - (pHeight / 2), pPosition[1] + (pWidth / 2), pPosition[2] + (pHeight / 2))
- end
-
- on display me, tScrollOffset
- pScrollOffset = rect(tScrollOffset[1], tScrollOffset[2], tScrollOffset[1], tScrollOffset[2])
- sprite(pSN).loc = pPosition + tScrollOffset
- sprite(pSN).width = pWidth
- sprite(pSN).height = pHeight
- if gEffects[#rotation] then
- sprite(pSN).rotation = pRotation
- else
- sprite(pSN).rotation = 0
- end if
- if gEffects[#blend] then
- sprite(pSN).blend = 100 - (max(pAnimProgression - pStartBlending, 0) * 100 / (1 - pStartBlending))
- else
- sprite(pSN).blend = 100
- end if
- end
-